测试链接：https://leetcode.cn/problems/happy-number/
class Solution {
public:
    int f(int n)
    {
        int help = 0;
        while(n)
        {
            help += pow(n%10, 2);
            n /= 10;
        }

        return help;
    }


    bool isHappy(int n) {
        if(n == 2) return false;

        int slow = f(n);
        int fast = f(f(n));

        while(slow != fast)
        {
            slow = f(slow);
            fast = f(f(fast));
        }

        fast = n;

        while(fast != slow && slow != 1)
        {
            slow = f(slow);
            fast = f(f(fast));
        }

        return slow == 1;//最后相遇点是不是1呢？

    }
};